import { Routes, Route } from 'react-router-dom'
import { Navigate } from 'react-router-dom'
//首页
import Index from './pages/index'
//详情页
import Detail from './pages/detail'
//登录页
import Login from './pages/login'
//注册页
import Register from './pages/register'
//订单页
import Order from './pages/order'
//优惠券页
import Voucher from './pages/voucher'
function App () {
  return (
    <div>
      <Routes>
        {/* 首页 */}
        <Route path='/index/*' element={<Index></Index>}></Route>
        {/* 详情页 */}
        <Route path='/detail/:id' element={<Detail></Detail>}></Route>
        {/* 订单页 */}
        <Route path='/order' element={<Order></Order>}></Route>
        {/* 登录 */}
        <Route path='/login' element={<Login></Login>}></Route>
        {/* 注册*/}
        <Route path='/register' element={<Register></Register>}></Route>
        {/* 优惠券*/}
        <Route path='/voucher' element={<Voucher></Voucher>}></Route>
        {/* 一级路由重定向 */}
        <Route path='*' element={<Navigate to='/index'></Navigate>}></Route>
      </Routes>
    </div>
  )
}

export default App
